﻿@using SwashbucklerDiary.IServices
@using SwashbucklerDiary.Models
@inherits MainNavigationCompontentBase

<MBottomNavigation Value="Value"
                   ValueChanged="ValueChanged"
                   InputValue="Show"
                   Class="d-flex justify-space-around"
                   Mandatory="true"
                   App="true">
    @foreach (var (item, i) in Items.Select((v, i) => (v, i)))
    {
        <MButton Ripple="false"
                 OnClick="item.OnClick">
            <MIcon>
                @(Value == i ? item.SelectedIcon : item.Icon)
            </MIcon>
        </MButton>
    }
</MBottomNavigation>

@code {

    private bool Show
    {
        get
        {
            if (!MasaBlazor.Breakpoint.Xs)
            {
                return false;
            }
            else
            {
                string[] links = { "", "history", "mine" };
                var url = Navigation!.ToBaseRelativePath(Navigation.Uri);
                return links.Any(it => it == url.Split("?")[0]);
            }
        }

    }
}